package com.alameda.controller.manage;

import com.alameda.api.manage.BusinessIndicatorService;
import com.alameda.manage.dto.BusinessIndicatorDTO;
import com.alameda.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 技术指标 前端控制层
 *
 * @author Lv
 * @date 2024/08/04
 */
@Api(tags = "技术指标")
@RestController
@RequestMapping("/business_indicator")
public class BusinessIndicatorController {

    @Autowired
    private BusinessIndicatorService businessIndicatorService;

    /**
     * 查询业务指标列表
     *
     * @param businessIndicatorDTO 技术指标数据传递对象
     * @return
     */
    @ApiOperation("查询业务指标列表")
    @PostMapping("/list_business_indicator")
    public Result<?> listBusinessIndicator(@RequestBody BusinessIndicatorDTO businessIndicatorDTO) {
        return Result.success(businessIndicatorService.listBusinessIndicator(businessIndicatorDTO));
    }

    /**
     * 添加或修改业务指标
     *
     * @param businessIndicatorDTO 技术指标数据传递对象
     * @return
     */
    @ApiOperation("添加或修改业务指标")
    @PostMapping("/save_or_update_business_indicator")
    public Result<?> saveOrUpdateBusinessIndicator(@RequestBody BusinessIndicatorDTO businessIndicatorDTO) {
        return Result.success(businessIndicatorService.saveOrUpdateBusinessIndicator(businessIndicatorDTO));
    }

    /**
     * 导出业务指标数据
     *
     * @param businessIndicatorDTO 技术指标数据传递对象
     */
    @ApiOperation("导出业务指标数据")
    @PostMapping("/export")
    public void export(@RequestBody BusinessIndicatorDTO businessIndicatorDTO) {
        businessIndicatorService.export(businessIndicatorDTO);
    }
}

